package Prototype;

public class ClientClass {
    public static void main(String[] args){

        MyFruit fru1 = new Apple();
        MyFruit fru2 = new Banana();
        MyFruitStore mfs1 = MyFruitStore.Getfruitstore();
        mfs1.Add(1,fru1);
        mfs1.Add(2,fru2);
        mfs1.Add(3,new Apple());
        mfs1.Add(4,new Banana());

        MyFruitStore mfs2 = MyFruitStore.Getfruitstore();
        /*
        MyFruit fru2 = fru1;
        MyFruit fru2 = (Apple)fru1.clone();
        fru1.Display();
        fru2.Display();
        System.out.println("fru1:"+fru1.hashCode());
        System.out.println("fru2:"+fru2.hashCode());
        System.out.println("fru1:"+fru1.toString());
        System.out.println("fru2:"+fru2.toString());
        System.out.println(fru1.equals(fru2));
        */

        MyFruit fru =(MyFruit) mfs1.Get(4);
        fru.Display();
        System.out.println("mfs1:"+mfs1.toString());
        System.out.println("mfs2:"+mfs2.toString());
    }

    public String factory(String fruitname){
        if(fruitname.equals("Apple"))
            return "Apple";
        if(fruitname.equals("Banana"))
            return "Banana";
        return null;
    }
}
